using System;
using NUnit.Framework;

namespace NUnit.Behave.Specs.TextMessageProvider_Specs
{
    [TestFixture]
    [Category("TextMessageProvider_Specs")]
    public class When_adding_a_story_title_message
    {
        [Test]
        public void Should_read_like_the_following_text()
        {
            TextMessageProvider messageProvider = new TextMessageProvider();
            messageProvider.AddMessage(MessageType.Story_Title, "This is a title");

            Assert.AreEqual("Story: This is a title\r\n", messageProvider.Render());
        }
    }

    [TestFixture]
    [Category("TextMessageProvider_Specs")]
    public class When_adding_an_As_a_message
    {
        [Test]
        public void Should_read_like_the_following_text()
        {
            TextMessageProvider messageProvider = new TextMessageProvider();
            messageProvider.AddMessage(MessageType.Story_As_A, "savings account holder");


            Assert.AreEqual("As a savings account holder\r\n", messageProvider.Render());
        }
    }

    [TestFixture]
    [Category("TextMessageProvider_Specs")]
    public class When_adding_an_I_Want_message
    {
        [Test]
        public void Should_read_like_the_following_text()
        {
            TextMessageProvider messageProvider = new TextMessageProvider();
            messageProvider.AddMessage(MessageType.Story_I_Want, "to transfer money from my savings account");

            Assert.AreEqual("I want to transfer money from my savings account\r\n", messageProvider.Render());
        }
    }

    [TestFixture]
    [Category("TextMessageProvider_Specs")]
    public class When_adding_a_So_That_message
    {
        [Test]
        public void Should_read_like_the_following_text()
        {
            TextMessageProvider messageProvider = new TextMessageProvider();
            messageProvider.AddMessage(MessageType.Story_So_That, "I can get cash easily from an ATM.");

            Assert.AreEqual(" so that I can get cash easily from an ATM.\r\n", messageProvider.Render());
        }
    }

    [TestFixture]
    [Category("TextMessageProvider_Specs")]
    public class When_you_have_full_story_object_graph
    {
        [Test]
        public void Should_read_like_the_following_text()
        {
            TextMessageProvider messageProvider = new TextMessageProvider();

            Story story = new Story("Account Holder withdraws cash");

            story.As_a("savings account holder")
                .I_want("to transfer money from my savings account")
                .So_that("I can get cash easily from an ATM");
            
            story.RenderTo(messageProvider);

            string expectedMessage = "Story: Account Holder withdraws cash\r\n" +
                                     "As a savings account holder\r\n" +
                                     "I want to transfer money from my savings account\r\n" +
                                     " so that I can get cash easily from an ATM\r\n";

            Assert.AreEqual(expectedMessage, messageProvider.Render());
            
        }
    }
}